package cn.wolfcode.rbac.service.impl;

import cn.wolfcode.rbac.mapper.RoleMapper;
import cn.wolfcode.rbac.pojo.Department;
import cn.wolfcode.rbac.pojo.Role;
import cn.wolfcode.rbac.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;


    @Override
    public List<Role> selectRole() {
        List<Role> roles = roleMapper.selectRole();
        return roles;
    }

    @Override
    public Role selectbyid(Integer id) {
        return roleMapper.selectbyid(id);
    }

    @Override
    public void save(Role role) {
        if (role.getId() != null) {
            roleMapper.updatebyid(role);
        } else {
            roleMapper.save(role);
        }
    }

    @Override
    public void delect(Integer id) {
        roleMapper.delectbyid(id);
    }
}
